﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace WebApplication1.Controllers
{
    public class TestController : Controller
    {
        // GET: Test
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult first()
        {
            ViewBag.Message = "关于界面";
            return View("~/Views/Home/About.cshtml");
        }
        public ActionResult second()
        {
            ViewBag.Title="第二种方法"
;            return View();
        }

        public ActionResult thirdly()
        {
            ViewBag.Title = "第三种方法";
            return View("second");
        }

        public ActionResult List()
        {
            List<Student> studentList = new List<Student>();
            for (int i = 0; i < 5; i++)
            {
                var stu = new Student { Name = string.Format("ID{0}", i), Age = "100" };
                studentList.Add(stu);
            }
            ViewBag.List = studentList;
            return View();
        }

    }

    public class Student
    {
        public string Name { get; set; }
        public string Age { get; set; }
    }
} 